package com.share.base.constant;
import lombok.AllArgsConstructor;
import lombok.Data;

/**
 * @author 小赵
 * @version 1.0
 * @data 2024-11-22 22:34
 */
@Data
@AllArgsConstructor
public class BaseReponse {
    //    响应码
    private Integer code;
    //    消息
    private String msg;
    //    数据
    private Object data;

    //    成功响应
    public static BaseReponse success(Object data) {
        return new BaseReponse(200, "success", data);
    }

    public static BaseReponse success(String msg, Object data) {
        return new BaseReponse(200, msg, data);
    }

    //  错误响应数据
    public static BaseReponse error(int code, String msg, Object data) {
        return new BaseReponse(code, msg, data);
    }

    public static BaseReponse error(String msg) {
        return new BaseReponse(500, msg,null);
    }
}

